﻿using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Runtime.Serialization;
using System.Text;

namespace CommunitySystemModel
{
    [Serializable]
    [DataContract]
   public  class Emp_DegreeModel
    {
        private int _ID;
        [DataMember]
        public int ID
        {
            get { return _ID; }
            set { _ID = value; }
        }

        private int _EmpBasicID;
        [DataMember]
        public int EmpBasicID
        {
            get { return _EmpBasicID; }
            set { _EmpBasicID = value; }
        }

        private DateTime? _EducationDate = null;
        [DataMember]
        public DateTime? EducationDate
        {
            get { return _EducationDate; }
            set { _EducationDate = value; }
        }

        private string _DegreeName = string.Empty;
        [DataMember]
        public string DegreeName
        {
            get { return _DegreeName; }
            set { _DegreeName = value; }
        }

        private string _LearningType = string.Empty;
        [DataMember]
        public string LearningType
        {
            get { return _LearningType; }
            set { _LearningType = value; }
        }

        private string _EducationalSystem = string.Empty;
        [DataMember]
        public string EducationalSystem
        {
            get { return _EducationalSystem; }
            set { _EducationalSystem = value; }
        }

        private string _School = string.Empty;
        [DataMember]
        public string School
        {
            get { return _School; }
            set { _School = value; }
        }

        private string _Professional = string.Empty;
        [DataMember]
        public string Professional
        {
            get { return _Professional; }
            set { _Professional = value; }
        }

        private string _EmpName = string.Empty;
        [DataMember]
        public string EmpName
        {
            get { return _EmpName; }
            set { _EmpName = value; }
        }

        private string _EmpNo = string.Empty;
        [DataMember]
        public string EmpNo
        {
            get { return _EmpNo; }
            set { _EmpNo = value; }
        }
        private string _JL = string.Empty;
        [DataMember]
        public string JL
        {
            get { return _JL; }
            set { _JL = value; }
        }
        private DateTime? _SYXWSJ = null;
        [DataMember]
        public DateTime? SYXWSJ
        {
            get { return _SYXWSJ; }
            set { _SYXWSJ = value; }
        }

        private string _SID = string.Empty;
        [DataMember]
        public string SID
        {
            get { return _SID; }
            set { _SID = value; }
        }
        private string _JCGZNX = string.Empty;
        [DataMember]
        public string JCGZNX
        {
            get { return _JCGZNX; }
            set { _JCGZNX = value; }
        }
        public static Emp_DegreeModel FillEntity(DataRow dr)
        {
            Emp_DegreeModel right = new Emp_DegreeModel();
            if (!string.IsNullOrEmpty(dr["ID"].ToString()))
                right.ID = (int)dr["ID"];
            if (!string.IsNullOrEmpty(dr["EmpBasicID"].ToString()))
                right.EmpBasicID = (int)dr["EmpBasicID"];
            right.DegreeName = dr["DegreeName"] as string;
            right.LearningType = dr["LearningType"] as string;
            right.EducationalSystem = dr["EducationalSystem"] as string;
            right.School = dr["School"] as string;
            right.Professional = dr["Professional"] as string;
            right.EmpName = dr["EmpName"] as string;
            right.EmpNo = dr["EmpNo"] as string;
            right.SID = dr["SID"] as string;
            right.JCGZNX = dr["JCGZNX"] as string;
            right.EducationDate = (string.IsNullOrEmpty(dr["EducationDate"].ToString()) || dr["EducationDate"].ToString() == "1900/1/1 0:00:00") ? null : (DateTime?)dr["EducationDate"];
            right.SYXWSJ = (string.IsNullOrEmpty(dr["SYXWSJ"].ToString()) || dr["SYXWSJ"].ToString() == "1900/1/1 0:00:00") ? null : (DateTime?)dr["SYXWSJ"];
            if (dr.Table != null && dr.Table.Columns.Contains("jl"))
                right.JL = dr["jl"] as string;
            
            return right;
        }
    }
}
